package com.groupsix.service.impl;

import com.groupsix.mapper.SysCarMapper;
import com.groupsix.mapper.SysCityMapper;
import com.groupsix.pojo.SysCar;
import com.groupsix.service.SysCarService;
import com.groupsix.vo.CityDtoVo;
import com.groupsix.vo.XcCarInfoVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class SysCarServiceImpl implements SysCarService {
    @Resource
    private SysCityMapper cityMapper;
    @Resource
    private SysCarMapper carMapper;
    @Override
    public XcCarInfoVo findXcCarInfo(int getid, int backid) {
        XcCarInfoVo xcCarInfoVo = new XcCarInfoVo();
        List<SysCar> sites = carMapper.findCarsByCidSortPrice(getid);
        xcCarInfoVo.setSites(sites);
        List<SysCar> cars = carMapper.findCarsByCidSortHot(getid);
        xcCarInfoVo.setCars(cars);
        CityDtoVo cities = cityMapper.findCityNameById(getid);
        String getName = cities.getCityName()+cities.getName();
        xcCarInfoVo.setGetcitys(getName);
        CityDtoVo cities2 = cityMapper.findCityNameById(backid);
        String backName = cities2.getCityName()+cities2.getName();
        xcCarInfoVo.setBackcitys(backName);
        return xcCarInfoVo;
    }
}
